package com.winenine999.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.winenine999.custom.dao.CPurchasesubMapper;
import com.winenine999.generator.dao.PurchasesubMapper;
import com.winenine999.model.Purchasesub;
import com.winenine999.service.IPurchasesubService;

@Service
public class PurchasesubService implements IPurchasesubService {
   @Autowired
   private  CPurchasesubMapper  cpurchasesubMapper;
   @Autowired
   private PurchasesubMapper purchasesubMapper;
   /**
    * 根据phid 查询     （采购子菜单 和酒产品的联查 ）
    * @return  phid 所对应的信息：
    * id,wid,proname
    * 
    */
	@Override
	public List<Map<String,Object>> getPurchasesubInfo(int phid) {
	
		return cpurchasesubMapper.getWinePronameByPhid(phid);
	}
/**
 * 根据phid查询purchasesub表中的所有酒产品（即查询该采购单已有的酒产品）
 */
@Override
public List<Integer> findWidsByPhid(Integer phid) {
	
	return cpurchasesubMapper.findWidsByPhid(phid);
}
//---------------------------------------------
/**
 * 根据id删除purchasesub
 */
@Override
public int deleteByPrimaryKey(Integer id) {
	
	return purchasesubMapper.deleteByPrimaryKey(id);
}
/**
 * 选择字段添加purchasesub
 */
@Override
public int insertSelective(Purchasesub purchasesub) {
	
	return purchasesubMapper.insertSelective(purchasesub);
}
/**
 * 根据id查询purchasesub
 */
@Override
public Purchasesub selectByPrimaryKey(Integer id) {
	
	return purchasesubMapper.selectByPrimaryKey(id);
}
/**
 * 选择字段修改purchasesub
 */
@Override
public int updateByPrimaryKeySelective(Purchasesub purchasesub) {
	
	return purchasesubMapper.updateByPrimaryKeySelective(purchasesub);
}


}
